<template>
  <div id="roles">
    <breadcrumb :mannage="mannage" :List="List" />
    <el-card>
      <el-button type="primary">添加角色</el-button>
      <el-table border :data="RolesList">
        <el-table-column type="expand">
          <template v-slot:default="scope">
            <el-row v-for="item in scope.row.children" :key="item.id">
              <el-col :span="7">
                <el-col :span="6">
                  <el-button type="primary" plain>{{item.authName}}</el-button>
                </el-col>
              </el-col>
              <el-col :span="17">2</el-col>
            </el-row>
          </template>
        </el-table-column>
        <el-table-column type="index" align="center"></el-table-column>
        <el-table-column
          label="角色名称"
          prop="roleName"
          align="center"
        ></el-table-column>
        <el-table-column
          label="角色名称"
          prop="roleDesc"
          align="center"
        ></el-table-column>
        <el-table-column label="操作" align="center">
          <template v-slot:default="scope">
            <el-tooltip
              class="item"
              effect="dark"
              content="编辑角色"
              placement="top"
            >
              <el-button type="primary" icon="el-icon-edit" circle></el-button>
            </el-tooltip>
            <el-tooltip
              class="item"
              effect="dark"
              content="删除角色"
              placement="top"
            >
              <el-button type="danger" icon="el-icon-delete" circle></el-button>
            </el-tooltip>
            <el-tooltip
              class="item"
              effect="dark"
              content="分配角色"
              placement="top"
            >
              <el-button
                type="warning"
                icon="el-icon-setting"
                circle
              ></el-button>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import Breadcrumb from "@/components/Breadcrumb/Breadcrumb";
import { getRoles } from "@/api/power.js";
export default {
  data() {
    return {
      mannage: "权限管理",
      List: "角色列表",
      RolesList: [],
    };
  },
  components: {
    Breadcrumb,
  },
  created() {
    this.getRolesList();
  },
  methods: {
    async getRolesList() {
      const { data: res } = await getRoles();
      this.RolesList = res.data;
      console.log(res);
    },
  },
};
</script>

<style>
</style>